import pygame
import sys

def check_keydown_event(event,charter):
     if event.key==pygame.K_d:
         charter.move_right=True
     elif event.key==pygame.K_a:
         charter.move_left=True
     elif event.key==pygame.K_k:
        charter.vectory_y=-35
def check_keyup_event(event,charter):
            if event.key==pygame.K_d:
                charter.move_right=False
            elif event.key==pygame.K_a:
                charter.move_left=False
def check_event(charter,bullet):
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            sys.exit()
        elif event.type==pygame.KEYDOWN:
            check_keydown_event(event,charter)
        elif event.type==pygame.KEYUP:
            check_keyup_event(event,charter)
def update_screen(ai_setting,screen,charter,bullet):
    screen.fill(ai_setting.bg_color)
    charter.blitime()
    bullet.bilitime()
    pygame.display.flip()
